import { createRequestTypes } from '@UTILS/reduxHelper'

export const ADD_PATIENT_MESSAGE = createRequestTypes('ADD_PATIENT_MESSAGE')
export const ENTER_PATIENT_SESSION = createRequestTypes('ENTER_PATIENT_SESSION')
export const PRE_ADD_PATIENT_MESSAGE = createRequestTypes('PRE_ADD_PATIENT_MESSAGE')
export const GET_PATIENT_MESSAGES = createRequestTypes('GET_PATIENT_MESSAGES')
export const GET_PATIENT_MESSAGE_BY_ID = createRequestTypes('GET_PATIENT_MESSAGE_BY_ID')
export const CLEAR_PATIENT_MESSAGE = createRequestTypes('CLEAR_PATIENT_MESSAGE')
export const GET_CONSULTATION_IN_CHATROOM = createRequestTypes('GET_CONSULTATION_IN_CHATROOM')
export const GET_ACTIVE_SESSION = createRequestTypes('GET_ACTIVE_SESSION')
export const UPDATE_AUDIO_MSG_TEXT = createRequestTypes('UPDATE_AUDIO_MSG_TEXT')
export const SET_AUDIO_PLAYED = createRequestTypes('SET_AUDIO_PLAYED')
export const UPDATE_SURVEY_STATUS = createRequestTypes('UPDATE_SURVEY_STATUS')
export const UPDATE_ENTITYSTATUS_STATUS = createRequestTypes('UPDATE_ENTITYSTATUS_STATUS')

export default {
  dispatchAddMessage(message) {
    return {
      type: ADD_PATIENT_MESSAGE.REQUEST,
      message
    }
  },
  dispatchUpdateAudioMsgText(params) {
    return {
      type: UPDATE_AUDIO_MSG_TEXT.SUCCESS,
      params
    }
  },
  dispatchSetAudioPlayed(id) {
    return {
      type: SET_AUDIO_PLAYED.REQUEST,
      id
    }
  },
  dispatchEnterSession({ sessionId, consultationId }) {
    return {
      type: ENTER_PATIENT_SESSION.REQUEST,
      SessionId: sessionId,
      ConsultationId: consultationId,
    }
  },
  dispatchPreAddMessage(message) {
    return {
      type: PRE_ADD_PATIENT_MESSAGE.SUCCESS,
      message
    }
  },
  dispatchGetMessages(sessionId) {
    return {
      type: GET_PATIENT_MESSAGES.REQUEST,
      sessionId
    }
  },
  dispatchGetChatMessageById(messageId) {
    return {
      type: GET_PATIENT_MESSAGE_BY_ID.REQUEST,
      messageId
    }
  },
  dispatchClearMessage() {
    return {
      type: CLEAR_PATIENT_MESSAGE.REQUEST
    }
  },
  dispatchGetConsultationInChatRoom(consultationId, sessionId) {
    return {
      type: GET_CONSULTATION_IN_CHATROOM.REQUEST,
      consultationId,
      sessionId
    }
  },
  dispatchUpdateSurveyStatus(sId, status) {
    return {
      type: UPDATE_SURVEY_STATUS.SUCCESS,
      sId,
      status,
    }
  },
  dispatchUpdateEntityStatus(entityId, status) {
    return {
      type: UPDATE_ENTITYSTATUS_STATUS.SUCCESS,
      entityId,
      status,
    }
  }
}

